//
//  InputAssiocalView.m
//  GIFShow
//
//  Created by 陈凯 on 15/6/2.
//  Copyright (c) 2015年 CK. All rights reserved.
//

#import "InputAssiocalView.h"
@interface InputAssiocalView()<UITextFieldDelegate>
@end

@implementation InputAssiocalView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.inputView = [[CKBackTextFieldButton alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        self.contentTextField.inputAccessoryView = self.inputView;
        self.contentTextField.delegate = self;
    }
    return self;
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    self.inputView.contentTextField.text = self.contentTextField.text;
    return YES;
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
    self.inputView.contentTextField.text = self.contentTextField.text;
}

-(void)addBackButtonTarget:(id)target AndAction:(SEL)action{
    [self.backButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [self.inputView.backButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}
-(void)addSubmitButtonTarget:(id)target AndAction:(SEL)action{
    [self.submitButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [self.inputView.submitButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Dawing code
 }
 */

@end
